#!/usr/bin/env python
# encoding: utf-8

"""Starter, it helps you to start the application.
To start with the built-in developing server just type `python starter.py`
or use the one you prefer, telling it the application it's "application"
(default for some servers, such as uWSGI).
"""

from spyro import *

application = Application('config.yaml')

if __name__ == '__main__':
    import sys
    if len(sys.argv) > 1:
        try:
            host, port = (sys.argv[1]).split(':')
            port = int(port)
        except ValueError: # maybe no port was specified
            host = sys.argv[1]
            port = 8080   
        Serve(Application('config.yaml'), host, port)
    else:
        Serve(Application('config.yaml'))
